<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" href="/static/css/amazeui.min.css" th:href="@{/static/css/amazeui.min.css}" media="all"/>
		<link rel="stylesheet" href="/static/css/admin.css" th:href="@{/static/css/admin.css}" media="all"/>
		<link rel="stylesheet" href="../layuiadmin/layui/css/layui.css" th:href="@{static/layuiadmin/layui/css/layui.css}" media="all">
    	<link rel="stylesheet" href="../layuiadmin/style/admin.css" th:href="@{static/layuiadmin/style/admin.css}" media="all">
  		<script type="text/javascript" src="../js/jquery-1.9.1.min.js" th:src="@{static/js/jquery-1.9.1.min.js}"></script>
  		<script type="text/javascript" src="../layuiadmin/layui/layui.js" th:src="@{static/layuiadmin/layui/layui.js}"></script>
  		<script type="text/javascript">
  			$(function(){
  				$("input[type=checkbox]").click(function(){
/*   					var questype = $(this).find("input[type=hidden]").attr("questype");
  					var quesid = $(this).find("input[type=hidden]").attr("quesid");
  					var score = $(this).find("input[type=text]").attr("value"); */
  					var questype = $(this).parent().prev().attr("questype");
  					var quesid = $(this).parent().prev().attr("quesid");
  					var score = $(this).parent().parent().find("input[id=quesscore]").val();
  					var ischioce = $(this).is(":checked")
//					alert(ischioce)
  					if(ischioce){
  						$.ajax({
  						type:"get",
  						async:false,
  						url:"/addquestomapper",
  						data:{
  							"questype":questype,
  							"quesid":quesid,
  							"score":score
  						},
  						dataType:"text",
  						success:function(e){
  							if(e == 'true'){
  								
  							}else{
								layui.use(['layer'], function(){
	  							var layer = layui.layer
	  							layer.msg('你已添加过该题');
								});
  							}
  						}
  					})
  					}else{
/*   						alert(ischioce) */
  						$.ajax({
  						type:"get",
  						url:"/deletequestomapper",
  						async:false,
  						data:{
  							"questype":questype,
  							"quesid":quesid,
  							"score":score
  						},
  						dataType:"text",
  						success:function(e){
  							if(e == 'true'){
  								
  							}else{
								layui.use(['layer'], function(){
	  							var layer = layui.layer
	  							layer.msg('系统异常');
								});
  							}
  						}
  					})
  					}
/*   					alert(quesid);
  					alert(questype);
  					alert(score); */
  				})
/*   				$("[id=quesscore]").click(function(){
  					$(this).removeAttr("value");
  				})
  				$("[id=quesscore]").blur(function(){
  					$(this).
  				}) */
  			})
  		</script>  
	</head>

	<body>
		<div class="admin-content-body">
			<div class="am-cf am-padding am-padding-bottom-0">
				<div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">选择题目</strong></div>
			</div>

			<hr>

			<div class="am-g">
				<div class="am-u-sm-12 am-u-md-6">
					<div class="am-btn-toolbar">
						<div class="am-btn-group am-btn-group-xs">
<!-- 						<a href="/addpaper" target="_parent"> -->
							<button type="button" class="am-btn am-btn-default" ><span class="am-icon-plus">组建试卷</span></button>
<!-- 						</a> -->
						</div>
					</div>
				</div>
				<div class="am-u-sm-12 am-u-md-3">

				</div>
				<div class="am-u-sm-12 am-u-md-3">
<!-- 					<div class="am-input-group am-input-group-sm">
						<input type="text" class="am-form-field">
						<span class="am-input-group-btn">
            <button class="am-btn am-btn-default" type="button">搜索</button>
          </span>
					</div> -->
				</div>
			</div>
			<div class="am-g">
				<div class="am-u-sm-12">
					<form class="am-form">
						<table class="am-table am-table-striped am-table-hover table-main">
							<thead>
								<div>
								<tr>
									<th class="table-check"></th>
									<th class="table-id">序号</th>
									<th class="table-title">题干</th>
									<th class="table-type">类别</th>
									<th class="table-author am-hide-sm-only"></th>
									<th class="table-date am-hide-sm-only"></th>
									<th class="table-set">分值</th>
								</tr>
								</div>
							</thead>
							<tbody>
								<div th:remove="(${questions.choiceQuestions} == null)? all:none">
								<tr th:each="choicequestion:${questions.choiceQuestions}" class="question">
								<input type="hidden" th:questype="${choicequestion.quesTypeId}" th:quesid="${choicequestion.choiceQuesId}">
									<td><input type="checkbox"></td>
									<td th:text="${choicequestionStat.count}">1</td>
									<td>
										<a href="#" th:text="${choicequestion.content}" alt="查看详情">选择题题干</a>
									</td>
									<td th:text="(${choicequestion.quesTypeId} == '1')? '单选题':'多选题'">选择题</td>
 									<td class="am-hide-sm-only"></td>
									<td class="am-hide-sm-only"></td>
									<td>
										<div class="am-btn-toolbar">
											<div class="am-btn-group am-btn-group-xs">
												<input type="text"  name="score" style="width: 70px;" id="quesscore" value="5"><span></span>
<!-- 												<button class="am-btn am-btn-default am-btn-xs am-text-secondary"><span class="am-icon-pencil-square-o"></span> 编辑</button>
												<button class="am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only"><span class="am-icon-trash-o"></span> 删除</button> -->
											</div>
										</div>
									</td>
								</tr>
								</div>
								<div th:remove="(${questions.judgeQuestions} == null)? all:none">
 								<tr th:each="judgequestion:${questions.judgeQuestions}" class="question">
 								<input type="hidden" th:questype="${judgequestion.quesTypeId}" th:quesid="${judgequestion.judgeId}">
									<td><input type="checkbox"></td>
									<td th:text="${judgequestionStat.count}">2</td>
									<td>
										<a href="#" th:text="${judgequestion.content}" alt="查看详情">判断题题干</a>
									</td>
									<td th:text="(${judgequestion.quesTypeId} == '4')? '判断题':'类别错误'">判断题</td>
									<td class="am-hide-sm-only"></td>
									<td class="am-hide-sm-only"></td>
									<td>
										<div class="am-btn-toolbar">
											<div class="am-btn-group am-btn-group-xs">
												<input type="text"  name="score" style="width: 70px;" id="quesscore" value="5">
<!-- 												<button class="am-btn am-btn-default am-btn-xs am-text-secondary"><span class="am-icon-pencil-square-o"></span> 编辑</button>
												<button class="am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only"><span class="am-icon-trash-o"></span> 删除</button> -->
											</div>
										</div>
									</td>
								</tr>
								</div>
								<div th:remove="(${questions.essayQuestions} == null)? all:none">
								<tr th:each="essayquestion:${questions.essayQuestions}" class="question">
								<input type="hidden" th:questype="${essayquestion.quesTypeId}" th:quesid="${essayquestion.quesAnsId}">
									<td><input type="checkbox"></td>
									<td th:text="${essayquestionStat.count}">3</td>
									<td>
										<a href="#" th:text="${essayquestion.content}" alt="查看详情">简答题题干</a>
									</td>
									<td th:text="(${essayquestion.quesTypeId} == '3')? '简答题':'填空'">简答题</td>
									<td class="am-hide-sm-only"></td>
									<td class="am-hide-sm-only"></td>
									<td>
										<div class="am-btn-toolbar">
											<div class="am-btn-group am-btn-group-xs">
												<input type="text"  name="score" style="width: 70px;" id="quesscore" value="10">
<!-- 												<button class="am-btn am-btn-default am-btn-xs am-text-secondary"><span class="am-icon-pencil-square-o"></span> 编辑</button>
												<button class="am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only"><span class="am-icon-trash-o"></span> 删除</button> -->
											</div>
										</div>
									</td>
								</tr> 
								</div>
							</tbody>
						</table>
<!-- 						<div class="am-cf">
							
							<div class="am-fr">
								<ul class="am-pagination">
									<li class="am-disabled">
										<a href="#">«</a>
									</li>
									<li class="am-active">
										<a href="#">1</a>
									</li>
									<li>
										<a href="#">2</a>
									</li>
									<li>
										<a href="#">3</a>
									</li>
									<li>
										<a href="#">4</a>
									</li>
									<li>
										<a href="#">5</a>
									</li>
									<li>
										<a href="#">»</a>
									</li>
								</ul>
							</div>
						</div> -->
						<hr>
					</form>
				</div>
			</div>
		</div>
	</body>
	<script src="/static/js/jquery-3.1.0.min.js" type="text/javascript" th:src="@{/static/js/jquery-3.1.0.min.js}" media="all"></script>
	<script src="/static/js/bootstrap.min.js" type="text/javascript" th:src="@{/static/js/bootstrap.min.js}" media="all"></script>
	<script src="/static/js/material.min.js" type="text/javascript" th:src="@{/static/js/material.min.js}" media="all"></script>

	<!--  Charts Plugin -->
	<script src="/static/js/chartist.min.js" th:src="@{/static/js/chartist.min.js}" media="all"></script>



	<script src="/static/js/material-dashboard.js" th:src="@{/static/js/material-dashboard.js}" media="all"></script>

	<!-- Material Dashboard DEMO methods, don't include it in your project! -->
	
	<script type="text/javascript" src="/static/myplugs/js/plugs.js" th:src="@{/static/myplugs/js/plugs.js}" media="all">
		</script>
		<script type="text/javascript">
			//添加编辑弹出层
			layui.use(['layer', 'form', 'element', 'flow', 'laypage'], function () {
			var layer=layui.layer
			$("[class='am-btn am-btn-default']").on("click", function (e) {
				layer.open({
				title:'添加试卷',
				type: 2,
				offset:['50px','100px'] ,
				area: ['46%', '32%'],
				content: 'toaddpaper',//这里content是一个普通的String,
			}
			);
		})
		})
			
/* 			function addpaper(title, id) {
				$.jq_Panel({
					title: title,
					iframeWidth: 500,
					iframeHeight: 300,
					url: "/toaddpaper"
				});
			} */
/*  			$(function () {
 				$('[class="material-icons"][id=1]').trigger("click");
				$('[class="material-icons"][id=1]').parent().parent().addClass("active");
			})  */
		</script>


<!-- 	<script type="text/javascript">
    	$(document).ready(function(){

$(".nav li").click(function(){
	
	$(".nav li").removeClass("active");
	$(this).addClass("active");
	
})

			// Javascript method's body can be found in assets/js/demos.js

    	});
	</script> -->
</html>